/*
 * @Descripttion:
 * @Author: Silence
 * @Date: 2023-06-07 14:02:39
 * @LastEditors: Silence
 * @LastEditTime: 2023-06-08 21:22:11
 */
import request from '@/utils/request.js'

export const loginApi = (data) => {
  return request.post('/login', data)
}
export const getAsideApi = () => {
  return request.get('/menus')
}
export const getuserApi = (data) => {
  return request.get('/users', {
    params: data
  })
}
export const stateApi = (id, bool) => {
  return request.put(`/users/${id}/state/${bool}`)
}
export const adduserApi = (data) => {
  return request.post('/users', data)
}
export const deluserApi = (id) => {
  return request.delete('/users/' + id)
}
export const detailuserApi = (id) => {
  return request.get('/users/' + id)
}
export const changeuserApi = (id, data) => {
  return request.put('/users/' + id, data)
}
export const getrolesApi = () => {
  return request.get('/roles')
}
export const changerolesApi = (id, rid) => {
  console.log(id, rid)
  return request.put(`/users/${id}/role`, { rid })
}
